(function(){
    var loader = new YAHOO.util.YUILoader({
        base: PHPmYBaseUrl ? PHPmYBaseUrl + "js/yui/build/" : "phpmy/js/yui/build/",
        require: ["cookie", "containercore", "container", "element", "connection", "tabview", "calendar", "animation", "dom", "dragdrop", "event", "button", "menu", "yahoo", "yahoo-dom-event", "yuiloader-dom-event"],
        loadOptional: true,
        filter: "MIN",
        onSuccess: function(){
            var loader2 = new YAHOO.util.YUILoader({
                base: PHPmYBaseUrl ? PHPmYBaseUrl + "js/yui/build/" : "phpmy/js/yui/build/" });
            // alert (loader);
            loader2.onSuccess = function(){
                jsReady();
            };
            loader2.onFailure = function(msg, xhrobj){
                alert('Problem: ' + msg);
            };
            loader2.onProgress = function(o){
            };
            //Add my modules to YUILoader
            loader2.addModule({
                name: "mypopupcal",
                type: "js",
                fullpath: PHPmYBaseUrl + "js/yui.cal.popup.js",
                varName: "popupcaljs",
                requires: ['calendar']
            });
            loader2.addModule({
                name: "mypopuppanel",
                type: "js",
                fullpath: PHPmYBaseUrl + "js/yui.panel.popup.js",
                varName: "popuppaneljs",
                requires: ['container', 'dragdrop']
            });
            loader2.addModule({
                name: "myxhrhandler",
                type: "js",
                fullpath: PHPmYBaseUrl + "js/yui.xhr.handler.js",
                varName: "xhrhandler",
                requires: ['connection']
            });
            loader2.addModule({
                name: "pagetopmenu",
                type: "js",
                fullpath: PHPmYBaseUrl + "/js/topmenu.function.js",
                varName: "pagetopmenu",
                requires: ['menu']
            });
            loader2.addModule({
                name: "stdfunc",
                type: "js",
                fullpath: PHPmYBaseUrl + "js/standard.function.js",
                varName: "stdfunc"
            });
            loader2.addModule({
                name: "popupmodalform",
                type: "js",
                fullpath: PHPmYBaseUrl + "js/yui.popup.modal.form.js",
                varName: "popupmodalform"
            });
            loader2.require("mypopuppanel");
            loader2.require("mypopupcal");
            loader2.require("myxhrhandler");
            loader2.require("pagetopmenu");
            loader2.require("stdfunc");
            loader2.require("popupmodalform");
            loader2.insert();
        },
        onFailure: function(msg, xhrobj){
            alert("LOAD FAILED: " + msg);
        }
    });
    // Load the files using the insert() method.
    loader.insert();
})();
